import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// vite.config.js
import Components from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    /* 按需引入antd */
    Components({
      resolvers: [AntDesignVueResolver()],
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
      'assets': fileURLToPath(new URL('./src/assets', import.meta.url)),
      'images': fileURLToPath(new URL('./src/assets/images', import.meta.url)),
      'libs': fileURLToPath(new URL('./src/assets/libs', import.meta.url)),
      'styles': fileURLToPath(new URL('./src/assets/styles', import.meta.url)),
      'videos': fileURLToPath(new URL('./src/assets/styles', import.meta.url)),
      'components': fileURLToPath(new URL('./src/components', import.meta.url)),
      'hooks': fileURLToPath(new URL('./src/hooks', import.meta.url)),
      'directive': fileURLToPath(new URL('./src/directive', import.meta.url)),
      'plugins': fileURLToPath(new URL('./src/plugins', import.meta.url)),
      'router': fileURLToPath(new URL('./src/router', import.meta.url)),
      'stores': fileURLToPath(new URL('./src/stores', import.meta.url)),
      'utils': fileURLToPath(new URL('./src/utils', import.meta.url)),
      'request': fileURLToPath(new URL('./src/request', import.meta.url)),
    }
  }
})
